<?php

// Base
$filelist = scandir_r($projectdir.'base/');
$bundles = dir_bundle($filelist,$projectdir.'base/',$maxsize);
$bases = array();
foreach ($bundles as $k => $bundle) $bases[] = make_tar($bundle,$name.'_'.$k,$repodir,$projectdir.'base/');

// Install
$filelist = scandir_r($projectdir.'install/');
$bundles = dir_bundle($filelist,$projectdir.'install/',$maxsize);
$installs = array();
foreach ($bundles as $k => $bundle) $installs[] = make_tar($bundle,$name.'_install_'.$k,$repodir,$projectdir.'install/');

// Upgrade
$filelist = scandir_r($projectdir.'upgrade/');
$bundles = dir_bundle($filelist,$projectdir.'upgrade/',$maxsize);
$upgrades = array();
foreach ($bundles as $k => $bundle) $upgrades[] = make_tar($bundle,$name.'_upgrade_'.$k,$repodir,$projectdir.'upgrade/');

$install = array_merge($bases,$installs);
$upgrade = array_merge($bases,$upgrades);

echo '<h1>Packaged</h1>';

echo '<h2>Install</h2>';
echo '<pre>'.make_lst($install,'install',$repodir).'</pre>';

echo '<h2>Upgrade</h2>';
echo '<pre>'.make_lst($upgrade,'upgrade',$repodir).'</pre>';
?>